//SPDX-FileCopyrightText: Copyright 2025-2025 深圳市同心圆网络有限公司
//SPDX-License-Identifier: GPL-3.0-only

package core

import "atomgit.com/openlinksaas-org/proto-gen-go.git/project_triger_api"

//Git相关的webhook属性

const (
	GIT_HOOK_TYPE = "git.hookType"
	GIT_NAME      = "git.name"
	GIT_WEB_URL   = "git.webUrl"
	GIT_HTTP_URL  = "git.httpUrl"
	GIT_SSH_URL   = "git.sshUrl"
	GIT_USERNAME  = "git.username"

	//tag hook相关属性
	GIT_TAG_BEFORE = "git.tag.before"
	GIT_TAG_AFTER  = "git.tag.after"
	GIT_TAG_REF    = "git.tag.ref"

	//push hook相关属性
	GIT_PUSH_BEFORE = "git.push.before"
	GIT_PUSH_AFTER  = "git.push.after"
	GIT_PUSH_REF    = "git.push.ref"

	//issue hook相关属性
	GIT_ISSUE_CREATE_AT = "git.issue.createAt"
	GIT_ISSUE_UPDATE_AT = "git.issue.updateAt"
	GIT_ISSUE_TITLE     = "git.issue.title"
	GIT_ISSUE_ACTION    = "git.issue.action"
	GIT_ISSUE_STATE     = "git.issue.state"
	GIT_ISSUE_URL       = "git.issue.url"

	//note hook相关属性
	GIT_NOTE_CREATE_AT = "git.note.createAt"
	GIT_NOTE_UPDATE_AT = "git.note.updateAt"
	GIT_NOTE_TITLE     = "git.note.title"
	GIT_NOTE_URL       = "git.note.url"

	//pr hook相关属性
	GIT_PR_ID              = "git.pr.id"
	GIT_PR_CREATE_AT       = "git.pr.createAt"
	GIT_PR_UPDATE_AT       = "git.pr.updateAt"
	GIT_PR_TITLE           = "git.pr.title"
	GIT_PR_SOURCE_BRANCH   = "git.pr.source.branch"
	GIT_PR_SOURCE_WEB_URL  = "git.pr.source.webUrl"
	GIT_PR_SOURCE_HTTP_URL = "git.pr.source.httpUrl"
	GIT_PR_SOURCE_SSH_URL  = "git.pr.source.sshUrl"
	GIT_PR_TARGET_BRANCH   = "git.pr.target.branch"
	GIT_PR_TARGET_WEB_URL  = "git.pr.target.webUrl"
	GIT_PR_TARGET_HTTP_URL = "git.pr.target.httpUrl"
	GIT_PR_TARGET_SSH_URL  = "git.pr.target.sshUrl"
)

var GitAttrDescGroupList []*project_triger_api.AttrDescGroup

func init() {
	GitAttrDescGroupList = []*project_triger_api.AttrDescGroup{
		{
			GroupName: "通用属性",
			AttrDescList: []*project_triger_api.AttrDesc{
				{
					AttrKey: COMMON_TRIGER_TYPE,
					Desc:    "触发器类型",
				},
				{
					AttrKey: COMMON_TRIGER_ID,
					Desc:    "触发器ID",
				},
				{
					AttrKey: COMMON_TRIGER_TIME_AT,
					Desc:    "触发时间",
				},
				//git通用属性
				{
					AttrKey: GIT_HOOK_TYPE,
					Desc:    "Git WebHook类型",
				},
				{
					AttrKey: GIT_NAME,
					Desc:    "仓库名称",
				},
				{
					AttrKey: GIT_WEB_URL,
					Desc:    "仓库网站地址",
				},
				{
					AttrKey: GIT_HTTP_URL,
					Desc:    "Git Clone https地址",
				},
				{
					AttrKey: GIT_SSH_URL,
					Desc:    "Git Clone ssh地址",
				},
				{
					AttrKey: GIT_USERNAME,
					Desc:    "触发的用户名",
				},
			},
		},
		{
			GroupName: "Tag Hook属性",
			AttrDescList: []*project_triger_api.AttrDesc{
				{
					AttrKey: GIT_TAG_BEFORE,
					Desc:    "标记变更前的sha",
				},
				{
					AttrKey: GIT_TAG_AFTER,
					Desc:    "标记变更后的sha",
				},
				{
					AttrKey: GIT_TAG_REF,
					Desc:    "标记名称",
				},
			},
		},
		{
			GroupName: "Push Hook属性",
			AttrDescList: []*project_triger_api.AttrDesc{
				{
					AttrKey: GIT_PUSH_BEFORE,
					Desc:    "Push前的sha",
				},
				{
					AttrKey: GIT_PUSH_AFTER,
					Desc:    "Push后的sha",
				},
				{
					AttrKey: GIT_PUSH_REF,
					Desc:    "Push的分支",
				},
			},
		},
		{
			GroupName: "Issue Hook属性",
			AttrDescList: []*project_triger_api.AttrDesc{
				{
					AttrKey: GIT_ISSUE_CREATE_AT,
					Desc:    "Issue创建时间",
				},
				{
					AttrKey: GIT_ISSUE_UPDATE_AT,
					Desc:    "Issue更新时间",
				},
				{
					AttrKey: GIT_ISSUE_TITLE,
					Desc:    "Issue标题",
				},
				{
					AttrKey: GIT_ISSUE_ACTION,
					Desc:    "对Issue的操作",
				},
				{
					AttrKey: GIT_ISSUE_STATE,
					Desc:    "Issue的状态",
				},
				{
					AttrKey: GIT_ISSUE_URL,
					Desc:    "Issue的web地址",
				},
			},
		},
		{
			GroupName: "Note Hook属性",
			AttrDescList: []*project_triger_api.AttrDesc{
				{
					AttrKey: GIT_NOTE_CREATE_AT,
					Desc:    "评论的创建时间",
				},
				{
					AttrKey: GIT_NOTE_UPDATE_AT,
					Desc:    "评论的更新时间",
				},
				{
					AttrKey: GIT_NOTE_TITLE,
					Desc:    "评论的标题",
				},
				{
					AttrKey: GIT_NOTE_URL,
					Desc:    "评论的web地址",
				},
			},
		},
		{
			GroupName: "PR Hook属性",
			AttrDescList: []*project_triger_api.AttrDesc{
				{
					AttrKey: GIT_PR_ID,
					Desc:    "PR ID",
				},
				{
					AttrKey: GIT_PR_CREATE_AT,
					Desc:    "PR创建时间",
				},
				{
					AttrKey: GIT_PR_UPDATE_AT,
					Desc:    "PR更新时间",
				},
				{
					AttrKey: GIT_PR_TITLE,
					Desc:    "PR标题",
				},
				{
					AttrKey: GIT_PR_SOURCE_BRANCH,
					Desc:    "源头仓库分支",
				},
				{
					AttrKey: GIT_PR_SOURCE_WEB_URL,
					Desc:    "源头仓库web地址",
				},
				{
					AttrKey: GIT_PR_SOURCE_HTTP_URL,
					Desc:    "源头仓库Git Clone https地址",
				},
				{
					AttrKey: GIT_PR_SOURCE_SSH_URL,
					Desc:    "源头仓库Git Clone ssh地址",
				},
				{
					AttrKey: GIT_PR_TARGET_BRANCH,
					Desc:    "目标仓库分支",
				},
				{
					AttrKey: GIT_PR_TARGET_WEB_URL,
					Desc:    "目标仓库web地址",
				},
				{
					AttrKey: GIT_PR_TARGET_HTTP_URL,
					Desc:    "目标仓库Git Clone https地址",
				},
				{
					AttrKey: GIT_PR_TARGET_SSH_URL,
					Desc:    "目标仓库Git Clone ssh地址",
				},
			},
		},
	}
}
